package com.mrcoder.sbmexcel.controller;

import com.mrcoder.sbmexcel.utils.excel.BigDecimalUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

@Controller
@RequestMapping("test")
public class TestController {


    @GetMapping("/toHtml")
    String test(HttpServletRequest request) {
        return "excelImport";
    }

    public static void main(String[] args) {
        BigDecimal amt=new BigDecimal(2000);
        BigDecimal amt2=new BigDecimal( -1050 );
        BigDecimal  amt3= BigDecimalUtils.add( amt2, amt );
        System.out.println(amt3);

        BigDecimal amt1=new BigDecimal(0);
        Integer winRoundCount = 3;
        Integer totalRoundCount=44;
        BigDecimal winRateAfter = new BigDecimal( ( winRoundCount / 12 ) * 100 );
        System.out.println(winRateAfter);

        double rate=winRoundCount*100/totalRoundCount;
        BigDecimal winRateAfter2 =new BigDecimal(rate);
        BigDecimal winRateAfter1 = BigDecimalUtils.divide(BigDecimalUtils. multiply( new BigDecimal( winRoundCount ), 100 ), new BigDecimal( totalRoundCount ) );
        System.out.println(winRateAfter1);
        System.out.println(winRateAfter2);
    }

}
